﻿using POC.Azure.Storage;
using POC.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;

namespace Blogger.UI
{
    public  static class AzureConfig
    {

#if DEBUG
        public static string configFile = "azure.debug.config";
#else
         public static string configFile = "azure.config";
#endif
        public static string nodeName = "/cset/azure/account";
        private static AzureAccount _account;

        public static AzureAccount AzureAccount
        {
            get { return AzureConfig._account; }
            set { AzureConfig._account = value; }
        }
        public static void RegisterAzure(HttpConfiguration config)
        {
            var applicationVirtualPath =  System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath;
            ApplicationConfiguration.BindFileReader(applicationVirtualPath + "\\" + configFile, nodeName);
            var IsLocalDevelopment = ApplicationConfiguration.Get(ConfigKeyConstant.UseLocalAccount).ToBoolean();
            _account = new AzureAccount(IsLocalDevelopment);
        }
    }
}